{template "header.html"}
<div class="note note-danger">
    <p>{dr_lang('对下单订单总价进行优惠')}</p>
</div>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="row myfbody ">
        <div class="col-md-12">

            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption">
                        <span class="caption-subject font-green sbold ">{dr_lang('活动内容')}</span>
                    </div>

                    <div class="actions">
                        <div class="btn-group">
                            <a class="btn" href="{$reply_url}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回列表')}</a>
                        </div>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="form-body">
                        <div class="form-group" id="dr_row_title">
                            <label class="control-label col-md-2">{dr_lang('活动主题')}</label>
                            <div class="col-md-5">
                                <input class="form-control " type="text" name="data[title]" id="dr_title" value="{$title}">
                            </div>
                        </div>
                        <div class=" form-group">
                            <label class="col-md-2 control-label">{dr_lang('活动条件')}</label>
                            <div class="col-md-9">
                                <label>
                                    <input type="text" class="form-control" name="data[money]" value="{$money}" />
                                </label>
                                <label>
                                    {dr_lang('单位：元 ，需要满足的金额')}
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-2 control-label">{dr_lang('促销类型')}</label>
                            <div class="col-xs-8">
                                <div class=" mt-radio-inline">
                                    {loop $ptype $n $v}
                                    <label class="mt-radio mt-radio-outline"> {$v}
                                        <input type="radio" onclick="dr_ptype('{$n}')" value="{$n}" {if $type==$n} checked{/if} name="data[type]">
                                        <span></span>
                                    </label>
                                    {/loop}
                                </div>
                            </div>
                        </div>
                        <div class="mytype form-group type_1" style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('满额打折')}</label>
                            <div class="col-md-9">
                                <label>
                                    <input type="text" class="form-control" name="value[1]" value="{$value}" />
                                </label>
                                <label>
                                    {dr_lang('单位：% ，1-100 如果打9折，请输入90')}
                                </label>
                            </div>
                        </div>
                        <div class="mytype form-group type_2" style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('立减金额')}</label>
                            <div class="col-md-9">
                                <label>
                                    <input type="text" class="form-control" name="value[2]" value="{$value}" />
                                </label>
                                <label>
                                    {dr_lang('订单价格 - 立减金额 = 购买价格')}
                                </label>
                            </div>
                        </div>
                        <div class="mytype form-group type_4" style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('赠送现金')}</label>
                            <div class="col-md-9">
                                <label>
                                    <input type="text" class="form-control" name="value[4]" value="{$value}" />
                                </label>
                                <label>
                                    {dr_lang('购买后返现的金额（元）')}
                                </label>
                            </div>
                        </div>
                        <div class="mytype form-group type_5" style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('赠送金币')}</label>
                            <div class="col-md-9">
                                <label>
                                    <input type="text" class="form-control" name="value[5]" value="{$value}" />
                                </label>
                                <label>
                                    {dr_lang('购买后返现的金币（%s）', SITE_SCORE)}
                                </label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-md-2">{dr_lang('开始时间')}</label>
                            <div class="col-md-9">
                                <div class="form-date input-group">
                                    <div class="input-group date field_date_stime">
                                        <input name="data[stime]" type="text" style="width:160px;" value="{date('Y-m-d H:i', $stime)}"  required="required" class="form-control ">
                                        <span class="input-group-btn">
                                            <button class="btn default date-set" type="button">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-2">{dr_lang('结束时间')}</label>
                            <div class="col-md-9">
                                <div class="form-date input-group">
                                    <div class="input-group date field_date_etime">
                                        <input name="data[etime]" type="text" style="width:160px;" value="{date('Y-m-d H:i', $etime)}"  required="required" class="form-control ">
                                        <span class="input-group-btn">
                                            <button class="btn default date-set" type="button">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('状态设置')}</label>
                            <div class="col-md-9">
                                <input type="checkbox" name="data[status]" value="1" {if $status}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('用户范围')}</label>
                            <div class="col-md-9">
                                <div class="mt-checkbox-inline">
                                    {loop $ci->member_cache['group'] $t}
                                    <label class="mt-checkbox mt-checkbox-outline">
                                        <input type="checkbox" name="data[member][]" value="{$t.id}" {if in_array($t.id, $groups)} checked{/if}> {$t.name}
                                        <span></span>
                                    </label>
                                    {/loop}
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('活动描述')}</label>
                            <div class="col-md-9">
                                <textarea class="form-control " style="height:90px" name="data[description]">{$description}</textarea>
                            </div>
                        </div>

                    </div>
                </div>
            </div>


        </div>

    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">

            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button>
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000', '{$reply_url}')" class="btn yellow"> <i class="fa fa-mail-reply-all"></i> {dr_lang('保存并返回')}</button>

        </div>
    </div>
</form>

<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/moment.min.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.finecms.js" type="text/javascript"></script>


<script type="text/javascript">
    $(function(){
        dr_ptype('{$type}');
    });
    function dr_ptype(i) {
        $('.mytype').hide();
        $('.type_'+i).show();
    }
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            $(".field_date_etime").datetimepicker({
                isRTL: App.isRTL(),
                format: "yyyy-mm-dd hh:ii",
                showMeridian: true,
                autoclose: true,
                pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
                todayBtn: true
            });
            $(".field_date_stime").datetimepicker({
                isRTL: App.isRTL(),
                format: "yyyy-mm-dd hh:ii",
                showMeridian: true,
                autoclose: true,
                pickerPosition: (App.isRTL() ? "bottom-right" : "bottom-left"),
                todayBtn: true
            });
        });
    }

</script>

{template "footer.html"}